<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>

<%

String path = request.getContextPath();
	String BasePath=request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";

%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>川轻化健身房</title>
  <meta name="description" content="Ela Admin - HTML5 Admin Template">
    <meta name="viewport" content="width=device-width, initial-scale=1">



<link href="<%=BasePath%>/static/time/css/bootstrap-datetimepicker.min.css" rel="stylesheet" media="screen">
<link rel="stylesheet" href="<%=BasePath%>/staticassets/css/normalize.css">
<link rel="stylesheet" href="<%=BasePath%>/staticassets/css/bootstrap.min.css">
<link rel="stylesheet" href="<%=BasePath%>/static/assets/css/font-awesome.min.css">
<link rel="stylesheet" href="<%=BasePath%>/static/assets/css/themify-icons.css">
<link rel="stylesheet" href="<%=BasePath%>/static/assets/css/style.css">
<link rel="stylesheet" href="<%=BasePath%>/static/vendor/bootstrap/css/bootstrap.css" />
<link href='https://fonts.googleapis.com/css?family=Open+Sans:400,600,700,800' rel='stylesheet' type='text/css'>
<script type="text/javascript"
	src="<%=BasePath%>/static/vendor/jquery/jquery-1.10.2.min.js"></script>
<script type="text/javascript"
	src="<%=BasePath%>/static/vendor/bootstrap/js/bootstrap.min.js"></script>



</head>

<body>




	<!-- Left Panel -->
	    <!-- Left Panel -->
    <aside id="left-panel" class="left-panel">
        <nav class="navbar ">
            <div id="main-menu" class="main-menu ">
                <ul class="nav navbar-nav">
                    <li class="menu-item "><a href="../admin/index" class="dropdown-toggle"><i
                            class="menu-icon fa fa-home"></i>主页</a></li>
                    <li class="menu-title">会员管理</li>
                    <!-- /.menu-title -->
                    <li class="menu-item"><a href="../admin/member"
                                             class="dropdown-toggle"> <i class="menu-icon  fa fa-search"></i>查看会员信息
                    </a></li>

                    <li class="menu-title">教练管理</li>
                    <!-- /.menu-title -->
                    <li class="menu-item "><a href="../admin/coachs"
                                              class="dropdown-toggle"> <i class="menu-icon fa   fa-users"></i>查看教练信息
                    </a></li>
                    <li class="menu-item"><a href="../admin/addcoach"
                                             class="dropdown-toggle"> <i
                            class="menu-icon fa  fa-cut (alias)"></i>激活教练账号
                    </a></li>
                    <li class="menu-title">公告信息管理</li>
                    <li class="menu-item "><a href="../admin/notice"
                                                    class="dropdown-toggle"> <i
                            class="menu-icon fa    fa-location-arrow"></i>查看公告信息
                    </a></li>
                    <li class="menu-item active"><a href="../admin/addnotice"
                                             class="dropdown-toggle"> <i class="menu-icon fa    fa-align-justify"></i>添加公告信息
                    </a></li>



                </ul>
            </div><!-- /.navbar-collapse -->
        </nav>
    </aside>
    <!-- /#left-panel -->
    <!-- Right Panel -->
    <div id="right-panel" class="right-panel">
        <!-- Header-->
        <header id="header" class="header">
            <div class="top-left">
              <div class="navbar-header">
                   <a class="navbar-brand" href="./"><p style="font-size:30px" >健身房后台管理</p></a>

                   <a id="menuToggle" class="menutoggle"><h4><i class="fa fa-bars fa-lg"></i></h4></a>
                </div>
            </div>
            <div class="top-right">
                <div class="header-menu">
                <div class="header-left">

					</div>
                    <div div class="user-area dropdown float-right">	
                   <span class="text-success"> <%HttpSession name = request.getSession(); %>
                                            <%=name.getAttribute("adminname") %>欢迎你！</span>
                                              </div>


                </div>
            </div>
        </header>

        <div class="content">
            <div class="col-lg-6">
                <div class="card">

                    <div class="card-body card-block">
                        <form action="#" method="post" enctype="multipart/form-data" class="form-horizontal">

                            <div class="row form-group">
                                <div class="col col-md-3"><label for="text-input" class=" form-control-label">标题</label></div>
                                <div class="col-12 col-md-9"><input type="text" id="text-input" name="text-input" placeholder="请输入标题" class="form-control"></div>
                            </div>
                            <div class="row form-group">
                                <div class="col col-md-3"><label for="text-input" class=" form-control-label">类型</label></div>
                                <div class="col-12 col-md-9">
                                    <input type="radio" class="radio-button" name="type" value="公告">公告</input>
                                    <input type="radio" class="radio-button" name="type" value="资讯">资讯</input>
                                </div>
                            </div>
                            <div class="row form-group">
                                <div class="col col-md-3"><label for="textarea-input" class=" form-control-label">内容</label></div>
                                <div class="col-12 col-md-9"><textarea name="textarea-input" id="textarea-input" rows="9" placeholder="请输入内容" class="form-control"></textarea></div>
                            </div>
                            <div class="row form-group">
                                <div class="col-12 col-md-9" align="center">
                                    <button type="button"  class="btn btn-primary" onclick="addnotice()">发布</button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
	</div>


    <script src="<%=BasePath%>/static/assets/js/vendor/jquery-2.1.4.min.js"></script>
    <script src="<%=BasePath%>/static/assets/js/popper.min.js"></script>
    <script src="<%=BasePath%>/static/assets/js/bootstrap.min.js"></script>
    <script src="<%=BasePath%>/static/assets/js/jquery.matchHeight.min.js"></script>
    <script src="<%=BasePath%>/static/assets/js/main.js"></script>
    <script type="text/javascript" src="<%=BasePath%>/static/time/jquery/jquery-1.8.3.min.js" charset="UTF-8"></script>
<script type="text/javascript" src="<%=BasePath%>/static/time/bootstrap/js/bootstrap.min.js"></script>
<script type="text/javascript" src="<%=BasePath%>/static/time/js/bootstrap-datetimepicker.js" charset="UTF-8"></script>
<script type="text/javascript" src="<%=BasePath%>/static/time/js/bootstrap-datetimepicker.zh-CN.js" charset="UTF-8"></script>
<script type="text/javascript">
    function addnotice(){
        var title = $("#text-input").val();
        var type = $("input[name='type']:checked").val();
        var content = $("#textarea-input").val();
        console.log(title+"\n"+type+"\n"+content);
        if(title == "" || type == "" || content == ""){
            alert("所有项目不能为空");
            return;
        }
        $.ajax({
            url:"../admin/insertNotice",
            type:"post",
            data:{
                title:title,
                type:type,
                content:content
            },
            success:function (data) {
              if(data.msg == "success"){
                  alert("发布成功");
                  window.location.href="../admin/addnotice";
              }
            }
        })
    }
</script>

</body>
</html>
